#include "nad_hallekomplett.h"
#include <GL/gl.h>

extern int torbewegung = 0;

void draw_palette_fass(int i){
       if (i =1) fassblau = fassblau;
       else fassblau = fassrot;
      glPushMatrix();  //pallette mit 4faessern
      	glScalef(0.4,0.4,0.4);
      	glPushMatrix();
       	  glScalef(0.4,0.4,0.4); 
          glTranslatef(0,0.8,0);
	 	draw_palette();
        glPopMatrix();
	glPushMatrix();
           glScalef(0.3,0.3,0.3); 
           glTranslatef(5,3,6);
	     draw_fass(fassblau);
	   glTranslatef(0,0,-9);
	     draw_fass(fassblau);
 	   glTranslatef(-9,0,0);
 	     draw_fass(fassblau);
 	   glTranslatef(0,0,9);
 	     draw_fass(fassblau);
       glPopMatrix();
      glPopMatrix();//pallette mit faessern ende


}

// void setSpot(){
// 
// for (int indexa=0; indexa<7; indexa++) {
// 			glTranslatef(0,0,12);
// 			glPushMatrix();// hlampe1
// 			for (int indexi=0; indexi<5; indexi++) {
// 			glTranslatef(16,0,0);
// 				 hbox(4);
// 			
// 			}
// 			glPopMatrix();// hlampe1
// 	}
// 
// }
// 


void draw_komplette_halle(void) {
  
  glPushMatrix(); // MAIN 
     glTranslatef(75,0,90);
     glRotatef(-90,0,1,0);
     glScalef(0.8,0.8,0.8);
     draw_halle();
     
  	glPushMatrix(); //aufsatz
    	  glTranslatef(0,0,0);
    	  haufsatz();
 	  glTranslatef(-20,0,-10);
 	  glRotatef(90,0,-1,0);
    	  haufsatz();
  	glPopMatrix();//aufsatz ende 
  
	// Kistenblock----------------------------
	glPushMatrix(); // kisten3
		glTranslatef(20,-2.0,-40);
	for (int indexaa=0; indexaa<8; indexaa++) {
	glTranslatef(0,2.01,0);
	glPushMatrix();// kisten2
	for (int indexa=0; indexa<8; indexa++) {
		glTranslatef(0,0,2.02);
		glPushMatrix();// kisten1
		for (int indexi=0; indexi<7; indexi++) {
		glTranslatef(2.02,0,0);
			hbox( (((indexa*indexaa+indexi)*(indexa+indexaa*indexi))%3));
		}
		glPopMatrix();// kisten1
	}
	glPopMatrix();// kisten2
	}
	glPopMatrix(); // kisten3
	// Kisten ende------------------------------------------


	//  lampen
	glPushMatrix();// hlampe1
	glTranslatef(-8,0.3,-4);
	for (int indexa=0; indexa<7; indexa++){
			glTranslatef(0,0,12);
			glPushMatrix();// hlampe1
			for (int indexi=0; indexi<5; indexi++) {
			glTranslatef(16,0,0);
				 hlampe();
				 hlsr();
			}
			glPopMatrix();// hlampe1
	}
        glPopMatrix();// hlampe2
	//  lampen ende

	// raum
   	glPushMatrix();
          glScalef(1,1.5,1);
          glTranslatef(-53,0,-45);
      	   raum();
           rtuer();
           //rfenster();
   	glPopMatrix();
	// raum ende
	
	// regale
	glPushMatrix();
         glTranslatef(10,0,5);
	    for (int indexa=0; indexa<5; indexa++) {
			glTranslatef(0,0,10);
			glPushMatrix();// hlampe1
			for (int indexi=0; indexi<2; indexi++) {
			glTranslatef(-16,0,0);
				 hregal();
			}
			glPopMatrix();// hlampe1
	}
	glPopMatrix();
	// regale ende
	
	// platten
	glPushMatrix();
         glTranslatef(36,0,0);
	   platte();
	 glTranslatef(0,0,5);
	   platte();      
         glTranslatef(0,0,5);
	   platte();      
	 glTranslatef(0,0,5);
	   platte();      
         glTranslatef(-0.5,0,-2.5);
	   platte();
	 glTranslatef(0,0,-5);
	   platte();      
         glTranslatef(0,0,-5);
	   platte();
	 glTranslatef(0,0,-5);
	   platte();      
       glPopMatrix();
	// platten  ende
	
	//paletten
	glPushMatrix();
	  glTranslatef(40,0,-10);
	  draw_hpalette();
	glPopMatrix();
	//paletten end

	// palletten mit faessern
 	glPushMatrix();
	 glTranslatef(-56.8,4.1,-10);
	   draw_palette_fass(1);
    	 glTranslatef(0,0,3);
	   draw_palette_fass(1);
       glPopMatrix();
	// paletten mit faessern ende

	// treppen
	glPushMatrix();
         glTranslatef(-49.5,0,-49.5);
	 draw_treppe();
	 glRotatef(90,0,1,0);
	 glTranslatef(-60,0,0.2);
	 draw_treppe();
       glPopMatrix();
	// treppen ende

/*	// container in der halle
 	glPushMatrix();
         glTranslatef(-69,-4,39);
         glScalef(0.5,0.5,0.5);
           glRotatef(90,-1,0,0);

        for (int indexaa=0; indexaa<3; indexaa++) {
           glTranslatef(0,0,8.01);
           glPushMatrix();
           for (int indexa=0; indexa<4; indexa++) {
			glTranslatef(18,0,0);
			glPushMatrix();// container1
			for (int indexi=0; indexi<3; indexi++) {
			glTranslatef(0,6,0);
			    draw_container();
			}
			glPopMatrix();// container1
	   }
	glPopMatrix();
	}
       glPopMatrix();
	// container in der halle end
	*/

	// tor
       glPushMatrix();
         glTranslatef(-2.0,0,0);
         glTranslatef(torbewegung,0,0);
	 htor();
       glPopMatrix();
	// tor end



	// regale fuellen
	glPushMatrix(); 
	  glTranslatef(-29.0,2.045,-43);
	 // regal1-----------------------------------------
         glPushMatrix(); // fach 1
         draw_flasche();
         glTranslatef(1,0,0);
         draw_flasche();
         glTranslatef(1,0,0);
         draw_flasche();
         glTranslatef(1,0,0);
         draw_flasche();
         glTranslatef(0.5,-0.9,-1.3);
         hbox(3);
         glTranslatef(-4,0.9,0.8);
         draw_flasche();
         glTranslatef(1,0,0);
         draw_flasche();
         glTranslatef(1,0,0);
         draw_flasche();
         glTranslatef(1,0,0);
         draw_flasche();
         glTranslatef(6,-0.9,-0.8);
         hbox(2);
        glPopMatrix();// fach 1
        glTranslatef(-1.5,1.6,-1.45);
        glPushMatrix(); // fach 2
          hbox(2);
          glTranslatef(2.05,0,0);
          hbox(1);
          glTranslatef(2.05,0,0);
          hbox(2);
          glTranslatef(2.05,0,0);	
        glPopMatrix();// fach 2
	//regal1 ende---------------------------------
	 
	 // regal2-----------------------------------------
          glPushMatrix(); 
         glTranslatef(20,-1.5,1);
         // fach 1
           glScalef(0.2,0.2,0.2);
	   draw_fass(fassblau);
	   glTranslatef(10,0,0);
	   draw_fass(fassblau);
	   glTranslatef(10,0,0);
	   draw_fass(fassrot);
	   glTranslatef(10,0,0);
	   draw_fass(fassblau);
	 // fach 2
	 glTranslatef(-40,12,0);
	   draw_fass(fassrot);
	 glTranslatef(8,0,0);
	   draw_fass(fassrot);
	   glTranslatef(8,0,0);
	   draw_fass(fassrot); 
	   glTranslatef(15,0,0);
	   draw_fass(fassblau);
	   glTranslatef(8,0,0);
	   draw_fass(fassrot);
	   glTranslatef(8,0,0);
	   draw_fass(fassrot);
	   glTranslatef(-49,20.25,-6);
	   glScalef(5,5,5);
	   hbox(1);
	   glTranslatef(9.5,0,0);
	   hbox(2);
	 // fach 3
        glPopMatrix();
	//regal2 ende---------------------------------
	
	
	
	 // regal3-----------------------------------------
          glPushMatrix(); 
          glTranslatef(0.5,0,10);
          // fach 1
          hbox(2);
          glPushMatrix();
            glTranslatef(3.8,1,1);
            glScalef(0.25,0.25,0.25);
	    draw_fass(fassblau);
	    glTranslatef(11,0,0);
	    draw_fass(fassblau);
	  glPopMatrix();
	 glTranslatef(9,0,0);
	 hbox(2);
	 glPushMatrix();
            glTranslatef(4.1,1,1);
            glScalef(0.25,0.25,0.25);
	    draw_fass(fassrot);
	  glPopMatrix();
        glPopMatrix();
	//regal3 ende---------------------------------
	
	 // regal4-----------------------------------------
        glPushMatrix(); 
        
          glTranslatef(2,7.2,21);
        glPushMatrix();
          glScalef(0.5,0.5,0.5);
          glPushMatrix();
          glRotatef(-23,0,1,0);
          draw_hgasflasche();
           glPopMatrix();
          glTranslatef(5,0,0);
          draw_hgasflasche();
          glTranslatef(5,0,0);
          glPushMatrix();
          glRotatef(85,0,1,0);
          draw_hgasflasche();
           glPopMatrix();
          glTranslatef(5,0,0);
          draw_hgasflasche();
          glTranslatef(5,0,0);
          glPushMatrix();
          glRotatef(35,0,1,0);
          draw_hgasflasche();
           glPopMatrix();
         glPopMatrix();
         glTranslatef(-1,-4.75,-1);
         hbox(1);
         glTranslatef(2.8,0,0);
         hbox(2);
         glTranslatef(6,-4.8,0);
         hbox(2);
         glTranslatef(-2.8,0,0);
         hbox(1);
        glPopMatrix();
	//regal4 ende---------------------------------
	
	
	// regal5-----------------------------------------
        glPushMatrix(); 
          glTranslatef(4,-1.95,31);
          glPushMatrix();
            glRotatef(90,0,0,1);
            draw_hnagel();
          glPopMatrix();
          glTranslatef(6,0,0);
          glPushMatrix();
            glRotatef(90,0,0,1);
            draw_hnagel2();
          glPopMatrix();
          glTranslatef(1,4.4,-1.8);
	     hbox(1);
	  glTranslatef(-2.1,0,0);
	     hbox(4);
          glTranslatef(-4.5,0,0);
	     hbox(3);
        glPopMatrix();
	//regal5 ende---------------------------------
	

	// regal6-----------------------------------------
        glPushMatrix(); 
          glTranslatef(-1,-1.95,40);
            glScalef(0.5,0.5,0.5);
            draw_hgasflasche();
        glPopMatrix();
	//regal6 ende---------------------------------
	
	// regal6-----------------------------------------
        glPushMatrix(); 
          glTranslatef(18,-1.5,20.9);
          glPushMatrix();
          glScalef(0.2,0.2,0.2);
            draw_fass(fassrot);
          glTranslatef(7,0,0);
          draw_fass(fassrot);
          glTranslatef(11,0,0);
          draw_fass(fassblau);
          glTranslatef(13,0,0);
          draw_fass(fassrot);
          glTranslatef(8,0,0);
          draw_fass(fassblau);
	  glTranslatef(7,0,0);
          draw_fass(fassrot);
	  glPopMatrix();
	  
	  glTranslatef(0,2.5,-0.3);
	  draw_flasche();
	  glTranslatef(0.5,0,0);
	  draw_flasche();
	  glTranslatef(0.5,0,0);
	  draw_flasche();
	  glTranslatef(0.5,0,0);
	  draw_flasche();
	  glTranslatef(-0.25,0,0.5);
	  draw_flasche();
	  glTranslatef(-0.5,0,0);
	  draw_flasche();
	  glTranslatef(-0.5,0,0);
	  draw_flasche();
	  glTranslatef(-0.5,0,0);
	  draw_flasche();
	  
	  glTranslatef(7,0,0);
	  draw_flasche();
	  glTranslatef(2,0,0);
	  draw_flasche();
	  glTranslatef(0,4.1,-1.5);
	  hbox(3);
	  
        glPopMatrix();
	//regal6 ende---------------------------------
	
	//regal 7
	glPushMatrix();
           glTranslatef(15.2,-0.5,30.9);
           glPushMatrix();
             glRotatef(-11,0,0,1);
             draw_hnagel3();
	   glPopMatrix();
	   glTranslatef(2,0.46,-1.3);
	   hbox(1);
	   glTranslatef(2.8,0,0);
	   hbox(1);
	   glTranslatef(6.8,0,0);
	   hbox(3);
	   glTranslatef(0,4,0);
	   draw_hgasflasche();
	   
	   
	glPopMatrix();	
	//regal 7 ende-------------------

	glPopMatrix();
	// regale fuellen ende */

  
  
    glPopMatrix(); //MAIN ende
    
  
 
}
